<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title></title>
    <link rel="stylesheet" href="{$Assets}layui/css/layui.css">
    <style type="text/css">
.layui-table-body{
    overflow: hidden;
}
    </style>
</head>
<body>
{include file="public/header" /}


<div style=" padding:2%; ">
<form class="layui-form" action="">
	<fieldset class="layui-elem-field layui-field-title" >
  		<legend>基础信息</legend>
	</fieldset>
	<div class="layui-form-item">
    	<label class="layui-form-label">站点名称</label>
    	<div class="layui-input-inline">
     		<input type="text" name="main_title" lay-verify="required" value="{$info.main_title}" autocomplete="off" class="layui-input">
    	</div>
	</div>
	<div class="layui-form-item layui-form-text">
    <label class="layui-form-label">简介</label>
    <div class="layui-input-block">
      <textarea name="count" class="layui-textarea">{$info.count}</textarea>
    </div>
 	</div>
	<div class="layui-form-item">
    <label class="layui-form-label">短信</label>
    <div class="layui-input-block">
      <input type="checkbox" <?php if($info['sns'] =='1'){ echo 'checked=""'; }?> name="sns" lay-skin="switch" lay-filter="switchTest" lay-text="ON|OFF">
    </div>
  	</div>
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
  		<legend>微信设置</legend>
	</fieldset>
	<div class="layui-form-item">
    <label class="layui-form-label">APPID</label>
    <div class="layui-input-block">
      <input type="text" name="appid" lay-verify="title" autocomplete="off" value="{$info.appid}" class="layui-input">
    </div>
 	</div>
	<div class="layui-form-item">
    <label class="layui-form-label">SERCRET</label>
    <div class="layui-input-block">
      <input type="text" name="appsecret" lay-verify="title" autocomplete="off" class="layui-input" value="{$info.appsecret}" >
    </div>
 	</div>
	<div class="layui-form-item">
    <label class="layui-form-label">URL</label>
    <div class="layui-input-block">
      <input type="text" name="web_url" lay-verify="required" autocomplete="off" value="{$info.web_url}" class="layui-input">
    </div>
 	</div>
	
	<div class="layui-form-item" style=" margin-top:60px; text-align:right;">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit="" lay-filter="demo1">提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  	</div>
	
</form> 
</div>
<script src="{$Assets}layui/layui.js?t=1515376178709"></script>

<script>
layui.use('upload', function(){
  var $ = layui.jquery
  ,upload = layui.upload;
  
  //
  var uploadInst = upload.render({
    elem: '#test1'
    ,url: 'upload'
    ,before: function(obj){
      //ie8
      obj.preview(function(index, file, result){
        $('#demo1').attr('src', result); //base64
      });
    }
    ,done: function(res){
      //
      if(res.code > 0){
        return layer.msg('');
      }
      //
    }
    ,error: function(){
      //
      var demoText = $('#demoText');
      demoText.html('<span style="color: #FF5722;"></span> <a class="layui-btn layui-btn-xs demo-reload"></a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }
  });
  
  //
  upload.render({
    elem: '.demoMore'
    ,before: function(){
      layer.tips('123'+ this.url, this.item, {tips: 1});
    }
    ,done: function(res, index, upload){
      var item = this.item;
      console.log(item); //layui 2.1.0 
    }
  })
  //
  upload.render({
    elem: '#test20'
    ,url: '/upload/'
    ,done: function(res){
      console.log(res)
    }
  });
  
});
</script>

<script>
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  var $ = layui.jquery;
  
  //
  laydate.render({
    elem: '#date'
  });
  laydate.render({
    elem: '#date1'
  });
  
  //
  var editIndex = layedit.build('LAY_demo_editor');
 
  //

  //
  form.on('submit(demo1)', function(data){
    var datas=JSON.stringify(data.field);
	$.ajax({
                        type:"POST",
                        url: "{:url('set/setsave')}",
                        data:{data:datas},
                        dataType:"json",
                        success:function(ret_datas){
                            if(ret_datas==1){
                                layer.msg('修改成功!');
                                setTimeout(function(){
                                  parent.layer.close(iframe);
                                  parent.location.reload();
                                },"1000");
                            }else if(ret_datas==99){
                                layer.msg('修改异常');
                            }else{
                                layer.msg(ret_datas);
                            }
                        }
                    });
    return false;
  });
 
  //
  
  
});
</script>
{include file="public/footer"/}
</body>
</html>